package com.enums;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.util.JSONUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * @author linyukun
 * @date 2022/7/6 16:25
 */
public enum ApiReturnCodeEnum {


    SUCCESS("0", "请求成功"),

    SYSTEM_BUSY("-1", "系统繁忙，请稍后再试"),
    SYSTEM_ERROR("-2", "系统错误"),
    SYSTEM_OVERTIME("-3", "系统超时"),
    SYSTEM_MD5_ERROR("-4", "MD5加密错误"),

    SYSTEM_FALSE("-1","修改失败"),


    FORECAST_PARAM("600", "请完善所有参数维度的填写，再进行提交获取预测租金"),
    FORECAST_CITY("601", "库内没有，请重新输入城市名称"),

    PROJECT_NAME_ISFOUND("-1","该项目名称已存在，请重新输入！！！"),
    BRAND_ISFOUND("-1","该楼层品牌名称已存在，请重新输入！！！"),


    SYSTEM_ADMIN("-1","你没有权限，请联系管理员修改权限"),


    REQUESTTOOFTEN("500","您的IP访问太频繁，系统已经拦截请求，请稍后再试"),

    LACK_PARAMETER("1001", "缺失参数"),
    ILLEGAL_PARAMETER("1002", "不合法的参数"),
    ILLEGAL_APPID("1003", "不合法的appId"),
    ILLEGAL_REQUEST_FORMAT("1004", "不合法的请求格式"),
    LACK_APPID("1005", "缺少appId参数"),
    LACK_APPSECRET("1006", "缺少appSecret参数"),
    NEED_GET_REQUEST("1007", "需要GET请求"),
    NEED_POST_REQUEST("1008", "需要POST请求"),
    PARSE_JSON_ERROR("1009", "解析JSON内容错误"),
    INVALID_PARAMETER("1010", "参数错误"),
    NO_NEWS("1011","暂无消息"),
    ILLEGAL_URL("1012", "不合法的URL"),
    ILLEGAL_PARAMETER_WITH_POST("1013", "POST数据参数不合法"),
    TOKEN_OVERTIME("1014", "Token已过期"),
    TOKEN_WRONG("1015", "Token不正确"),
    CAPTCHA_OVERTIME("1016","验证码已失效，请重新输入！"),
    CAPTCHA_FAIL("1017","验证码错误"),
    CAPTCHA_ERROR("1018","验证码获取失败"),
    //MOBILE_ERROR("1019","手机格式错误"),
    USERNAME_EXITS("1020","用户名已经存在"),
    USERNAME_NOT_EXITS("1019","用户名不存在"),
    UID_PWD_ERROR("1021","账号或密码错误"),
    FORGET_PWD_NOTSAME("1022","两次输入密码不一致"),
    MOBILE_EXITS("1023","该手机号已经被占用了，请使用另一个手机号"),
    PERFECT_PERSONAL_DATA("1024","您已完善过了个人信息"),
    NONE_BRAND_SEE_LINK("1025","你还没查看过任何品牌联系人"),
    NONE_PROJECT_SEE_LINK("1026","你还没查看过任何项目联系人"),
    NID_IS_EXIST("1027","该昵称已经被使用了，请填写另一个昵称"),
    EMAIL_IS_EXIST("1028","该邮箱已经被使用了，请填写另一个邮箱"),
    /*UPDATE_SUCCESS_DATA("1025","更新成功"),*/
    UPDATE_ERROR_DATA("1029","更新失败"),
    DEFAULT_SEE_ALREADY_SITE("1030","7天内已经设置过一次，不能再设置"),
    OLD_NEW_MOBILE_SAME("1031","新手机号不能和旧手机号一致"),
    OLD_PWD_ERROR("1032","旧密码错误"),
    NEED_WSGRXX1("1033","请先完善个人资料"),//闻伴辉 2017-11-17 添加
    NEED_WSGRXX2("1034","请先完善个人资料"),//这个状态是要验证手机的 闻伴辉 2017-11-17 添加
    CHECK_TEL("1035","联系电话格式错误"),
    CHECK_EMAIL("1036","电子邮箱格式错误"),
    CHECK_MOBILE("1037","手机号格式错误"),
    CHECK_UID("1038","用户名格式错误，由英文,数字组成(不支持中文)，且不能少于四个字符"),
    CHECK_PWD("1039","密码格式错误，由英文,数字组成(不支持中文)，且不能少于6个字符"),
    MOBILE_NOT_EXIST("1040","手机号码不存在"),
    CHECK_SURE_PWD("1041","确认密码格式错误，由英文,数字组成(不支持中文)，且不能少于6个字符"),
    DEL_FAIL("1042","删除失败"),
    NO_LOGIN("2001", "您尚未登录"),
    REMOVE_FAIL("1043","移除失败，该联系人已在移除审核中"),
    ERRLIST_FAIL("1046","纠错失败，您已提交了该联系人纠错信息，请耐心等待审核！"),
    NOT_EMPTY_TUOZHANCITY("1044","请选择负责拓展区域"),
    NOT_EMPTY_YETAI("1045","请选择负责招商业态"),
    SEND_CODE_NUMBER_BEYOND_LIMIT("1046","抱歉,频繁获取验证码已超过上限，请联系客服！"),
    CHECK_NID_CHARVALID("1047","请不要输入特殊字符"),
    CHECK_NID_NUM("1048","昵称不能是纯数字"),
    ADD_ACTIVITYGUIDE_FAIL("1049","添加活动引导页信息失败，设备号已经存在，不能重复添加"),
    ACTIVITY_MORE_THAN_CHARACTER("1050","注册的活动名长度不能超过20个字符"),


    PROJECT_EXIST_PRIVATE("3001","该项目你已有管理权限，请去用户中心进行管理"),
    BRAND_EXIST_PRIVATE("3002","该品牌你已有管理权限，请去用户中心进行管理"),
    PROJECT_SUBMIT_CLAIM("3003","该项目你已提交认领，请耐心等待我们的认领审核"),
    BRAND_SUBMIT_CLAIM("3004","该品牌你已提交认领，请耐心等待我们的认领审核"),
    PROJECT_NOTEXIST_PRIVATE("3005","你没有认领权限"),
    PROJECT_NOTEXIST_ERROR("3006","认领失败"),
    PROJECT_NOTEXIST_ERROR2("3007","保存联系人信息失败"),
    FABU_PROJECT_SUBMIT_CLAIM("3008","该项目你已发布，请耐心等待我们的审核"),
    FABU_BRAND_SUBMIT_CLAIM("3009","该品牌你已发布，请耐心等待我们的审核"),
    FABU_NOTEXIST_ERROR("3010","发布失败"),


    NO_PROJECT("4001","未发布项目"),
    NO_BRAND("4002","未发布品牌"),
    NO_MAIN_PROJECT("4003","未设置主项目"),
    NO_MAIN_BRAND("4004","未设置主品牌"),
    NO_LINKMAN("4005","找不到联系人"),
    NO_YTZ_YEARSEENUM("4006","赢拓展年查看量为0"),
    NO_YTZ_DAYSEENUM("4007","赢拓展日查看量为0"),
    NO_YZS_YEARSEENUM("4008","赢招商年查看量为0"),
    NO_YZS_DAYSEENUM("4009","赢招商日查看量为0"),
    ERR_UPPROJECTSHOWNUM("4010","记录项目被查看量失败"),
    ERR_UPBRANDSHOWNUM("4011","记录品牌被查看量失败"),
    ERR_NOTYPE("4012","被查看的商机类型错误"),
    ERR_ADDSEELINK("4013","添加查看记录失败"),
    ERR_ADDSEELINKLOG("4014","添加查看日志失败"),
    ERR_ADDSEELINKLIST("4015","添加查看明细失败"),
    SHOWSTATE1("4016","您当天剩余可查看量为0，无法查看当前联系方式"),
    SHOWSTATE2_PROJECT("4017","您的品牌不符合项目招商业态，无法查看该联系方式"),
    SHOWSTATE2_PROJECT_NOTZHAOSHANG("4018","非常抱歉，该项目暂不招商，无法查看该联系方式"),
    SHOWSTATE2_BRAND("4019","您的项目不符合品牌拓展区域，无法查看该联系方式"),
    SHOWSTATE2_BRAND_NOTTUOZHAN("4020","非常抱歉，该品牌暂不拓展，无法查看该联系方式"),
    SHOWSTATE3_1("4021","该联系人信息设置了授权可见，需TA本人授权后方可见"),
    SHOWSTATE3_2("4022","您已提交申请授权，请耐心等待联系人通过授权"),
    SHOWSTATE3_3("4023","该联系人授权您已提交申请，7天内不可重复提交申请，请耐心等待联系人通过您的授权"),
    SHOWSTATE3_4("4024","该联系人信息设置了授权可见，需TA本人授权后方可见"),//授权拒绝的情况，PC版返回内容是没有申请的状态，这里单独一个枚举。
    SHOWSTATE3_5("4025","您有权限查看联系人，无需申请授权查看"),
    SHOWSTATE4("4026","该联系方式设置了对所有人不可见，无法查看该联系方式"),
    NO_DPZZ("4027","没找到相关店铺招租"),
    NOTVIP("4028","这个高潜品牌、头部品牌筛选为付费内容，请升级为赢商大数据付费会员后查看"),//3.4版本作废了
    NOTYZSVIP("4029","您查看的为赢招商会员专属品牌，请升级为赢招商会员查看详情，升级通道：020-37128238"),//3.4版本查看高潜品牌联系人的时候，需要验证是不是赢招商VIP

    HAVEPROJECT("5000","已经存在该项目，不能重复发布"),
    HAVEBRAND("5001","已经存在该品牌，不能重复发布"),
    CANNT_UP_PROJECT("5002","您没有权限编辑当前项目"),
    CANNT_UP_BRAND("5003","您没有权限编辑当前品牌"),
    NOT_PROJECT("5004","项目不存在，请检查参数"),
    NOT_BRAND("5005","品牌不存在，请检查参数"),
    POST_PROJECT_ERR("5006","保存项目基础信息失败"),
    POST_PROJECT_ERR_MORE("5007","保存项目详情信息失败"),
    POST_PROJECT_ERR_ZHAOSHANG("5008","保存项目招商信息失败"),
    POST_PROJECT_TOBASE("5009","请先完善项目基础信息"),
    POST_BRAND_TOBASE("5010","请先完善品牌基础信息"),
    POST_PROJECT_PERFECT_INFORMATION("5011","请先按步骤完善项目其他信息"),
    POST_BRAND_PERFECT_INFORMATION("5012","请先按步骤完善品牌其他信息"),
    POST_BRAND_PERFECT_MERCHANTS("5013","请选择负责招商业态"),
    POST_BRAND_PERFECT_AREA("5014","请选择拓展区域"),
    POST_BRAND_PERFECT_BRAND_DATA("5015","请上传个人名片"),
    POST_PROJECT_LACK_ID("5016","缺少项目id"),
    POST_BRAND_LACK_ID("5017","缺少品牌id"),
    POST_PROJECT_LACK_NAME("5018","请输入项目名称"),
    POST_BRAND_LACK_NAME("5019","请输入品牌名称"),
    POST_BRAND_LACK_CREATEDATE("5020","缺少品牌创立时间"),
    POST_BRAND_LACK_INDUSTRYTYPE1("5021","缺少品牌一级业态id"),
    POST_BRAND_LACK_LIST_INDUSTRYTYPE("5022","缺少品牌一级业态"),
    POST_BRAND_LACK_LIST_INDUSTRYTYPE2("5023","缺少品牌二级业态"),
    POST_BRAND_LACK_INDUSTRYTYPE_ID("5024","缺少品牌二级业态id"),
    POST_BRAND_LACK_LIST_KDFS("5025","缺少品牌开店方式"),
    POST_BRAND_LACK_LIST_KDFS_ID("5026","缺少品牌开店方式id"),
    POST_BRAND_LACK_LIST_JOINTYPENAME("5027","缺少品牌可进驻商业区类型"),
    POST_BRAND_LACK_LIST_JOINTYPEID("5028","缺少品牌可进驻商业区类型id"),
    //POST_BRAND_LACK_TAGNAME1("5029","缺少品牌标签"),
    POST_BRAND_ERR("5030","保存品牌基础信息失败"),
    POST_BRAND_ERR_MORE("5031","保存品牌详情信息失败"),
    POST_BRAND_ERR_TUOZHAN("5032","保存品牌拓展信息失败"),
    POST_PROJECT_NAME_3("5033","非常抱歉，该项目正在待审核中，无法进行发布"),
    POST_BRAND_NAME_3("5034","非常抱歉，该品牌正在待审核中，无法进行发布"),

    POST_BRAND_QIXIAN_MIN_ERROR("5035","合作期限最小值不能为空"),
    POST_BRAND_QIXIAN_MAX_ERROR("5036","合作期限最大值不能为空"),
    POST_BRAND_QIXIAN_MIN_MAX_ERROR("5037","合作期限最大值必须大于最小值"),
    POST_BRAND_KAIDIANNUM_ERROR("5038","已开店数量不能为空"),
    POST_BRAND_ISSHOWNEXTYEASE_ERROR("5039","下一年计划开店数不能为空"),
    POST_BRAND_THISYEAR_ERROR("5040","年份不能为空"),
    POST_BRAND_THISYEARNUM_ERROR("5041","今年计划开店数不能为空"),
    POST_BRAND_NEXTYEARNUM_ERROR("5042","明年计划开店数不能为空"),
    POST_BRAND_ISSHANGSHI_ERROR("5043","是否上市企业不能为空"),
    POST_BRAND_ZONGBUNAME_ERROR("5044","品牌所属企业名称不能为空"),
    POST_BRAND_CONTENT_ERROR("5045","品牌简介不能为空"),
    POST_BRAND_CONTENT_LENGHT_ERROR("5046","品牌简介不能少于100字"),
    POST_BRAND_BRANDLOGO_ERROR("5047","品牌Logo不能为空"),
    POST_BRAND_BRANDPICLIST_ERROR("5047","品牌图片不能为空"),

    POST_BRAND_MINMIANJI_ERROR("5048","可承受的铺位面积-最大不能为空"),
    POST_BRAND_MAXMIANJI_ERROR("5049","可承受的铺位面积-最大不能为空"),
    POST_BRAND_MIANJI_ERROR("5050","最大面积必须大于最小面积"),
    POST_BRAND_TUOZHANCITY_ERROR("5051","拓展城市不能为空"),
    POST_BRAND_TUOZHANCITYID_ERROR("5052","拓展城市Id不能为空"),

    POST_PROJECT_WUYELEIXING_OTHERLABLE("5053","请输入自定义项目类型"),
    POST_BRAND_LACK_LIST_INDUSTRYTYPE3("5054","请完善至最后一级业态"),






    NOHUODONG("6000","抱歉，活动已经结束"),
    NOPOWERTOSEETHIS("6001","抱歉，你没有访问权限"),
    OTHERUSERPOSS("6002","系统检测该品牌联系方式已被提交，正在审核"),
    OTHERUSERPOSS2("6003","系统检测该手机号码已被提交，正在审核"),
    OTHERUSERPOSS3("6004","该号码审核不通过，请输入其它号码"),




    ADMINVIDERR("7000","后台验证码错误"),
    OUT_OF_RANGE("7001","你添加的品牌达到上限50"),
    ADMIN_UID_EXITST("7002","后台账号不存在"),
    ADMIN_UID_PWD_ERR("7003","后台密码错误"),
    ADMIN_NOT_LOGIN("7004","您尚未登录后台"),//7004有特殊JS跳转
    ADMIN_ORTHER_LOGIN("7004","您的账号在其它终端登录"),//7004有特殊JS跳转
    ADMIN_NO_POWER("7005","您的账号沒有相关权限"),


    CITY_PRVIEW_ERROR("7006","修改未成功"),



    BRAND_OTHER_NAME_EXIST("8000","别名已存在，不能修改/新增")//品牌别名添加
    ;




    private int code;//返回码
    private String description;//说明

    private ApiReturnCodeEnum(String code, String description) {
        this.code =Integer.parseInt(code);
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Map<String, Object> asMap(){
        Map map = new HashMap<String, Object>();
        map.put("code", this.code);
        map.put("msg", this.description);

        return map;
    }

    public String asString(){
        try {
            return JSONUtils.getObjectMapper().writeValueAsString(this.asMap());
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }

        return "";
    }

}
